#pragma once

#include <Ogre.h>
#include <OgreBillboard.h>
#include <OgreBillboardSet.h>
#include <OgreConfigFile.h>
#include <OgreException.h>
#include <OgreMatrix4.h>
#include <OgreSceneManager.h>
#include <OgreStringConverter.h>
#include <OgreTextAreaOverlayElement.h>
#include <OgreVector3.h>
#include <OgreAnimationState.h>
#include <OgreCamera.h>
#include <OgreEntity.h>
#include <OgreLogManager.h>
#include <OgreRoot.h>
#include <OgreViewport.h>
#include <OgreRenderWindow.h>
#include <OgreConfigFile.h>

#include <OIS.h>
#include <OISEvents.h>
#include <OISInputManager.h>
#include <OISKeyboard.h>
#include <OISMouse.h>

#include <SdkTrays.h>
#include <SdkCameraMan.h>

#include <windows.h>
#include <mmsystem.h>
#include <tchar.h>
#include <Hikari.h>
#pragma comment(lib,"winmm.lib")
#include "library\Win32Window.h"
#include "SAFrameListener.h"
#include "Timer/Timer.hpp"
#include "library/SharePtr.h"
#include "GUIInteractive.h"

SHARE_PTR(Hikari::HikariManager, HikariManager)

class OgreMain
{
public:
	enum {
		STETUP_OK,
		INITALIZE_OK,
		SETBGM_OK,
	};
	OgreMain(){}
	int Setup(Ogre::String ResourcePath, Ogre::String PluginPath);
	int Initalize(int w, int h);
	void Go();
	void SetupResources();
	void ChooseSceneManager();
	void CreateCamera();
	void CreateViewports();
	void CreateScene();
	void ShowLoading();
	void ReleaseResources();
	void CreateFrameListener();
	void PlayBGM(std::wstring path);
	void StopBGN(std::wstring path);
	void UpdateFrame();
	void setupHikari();
	Hikari::FlashValue FlCall_Exit(Hikari::FlashControl* caller, const Hikari::Arguments& args);
private:
	Hikari::FlashControl*	m_controls;
	HikariManager_Sptr	m_hikariMgr;
	Timer			m_FrameTimer;
	double			m_UpdateTime;
	Ogre::Root*		m_Root;
	Ogre::RenderWindow*	m_RenderWindow;
	Ogre::Camera*		m_Camera;
	Ogre::SceneNode*	m_CamNode;
	Ogre::SceneManager*	m_SceneMgr;
	Ogre::String		m_ResourcePath;
	Ogre::String		m_PluginPath;
	Ogre::Viewport*		m_ViewPort;
	Win32Window		m_Win32Window;
	HWND			m_hwnd;
	SAFrameListener*	m_FrameListener;
	
	int SetBGM(Ogre::String soundpath);
};
